Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrl + [ support for exiting insert mode #536

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

drudgesentinel
Copy link

Added support for 'ctrl + [' to exit insert mode in the vi bundle.

Just duplicated the 'escape' portion of the insert_map.moon and swapped in the 'ctrl + ['

@@ -33,6 +33,12 @@ insert_map = {
state.change_mode editor, 'command'
editor.cursor.column = math.max 1, editor.cursor.column - 1

'ctrl_[': (editor) ->
state.insert_edit = get_edit editor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please extract the code into a exit_insert_mode function at the top next to get_edit?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored the code per your request. Let me know if there's anything else I can do!

state.change_mode editor, 'command'
editor.cursor.column = math.max 1, editor.cursor.column - 1

escape: (editor) -> exit_insert_mode editor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can just be written as

escape: exit_insert_mode

Same for next line.

Otherwise looks good to me!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I've done so.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that the ctrl + [ doesn't work when writing python code at least, there's probably something overriding the key combo for that syntax, I'll investigate further at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still want to merge this then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants